<html>
	{% include "../common_head.html" %}
	<body>
	{% include "../common_menus.html" %}
		<div id="content">
		
			<div id="rakontu_form_style" class="rakontu_form">
			<form action="/{{dir_manage}}/{{url_members}}?{{rakontu.urlQuery}}" method="post">
			
			{% if changes_saved %}
				<div class="message">{{template_changes_saved}}</div>
			{% endif %}

			<h3>{{template_active_members}}</h3>
			<fieldset>
	      	<table border="0" cellpadding="4" cellspacing="0">
	      	<tr>
	      		<th>{{template_information|capitalize}}</th>
	      		<th>{{template_last_reading}}</th>
	      		<th>{{template_last_entry}}</th
	      		<th width="100">{{template_nudge_points_accumulated}}</th>

	      		<th>{{template_membership_type}}</th>
	      		<th width="100">{{template_helping_roles_taken_on}}</th>
	      		<th width="100">{{template_helping_roles_available}} {{"available_helping_roles"|tip}}</th>
	      		<th>{{template_inactivate}}?</th>
	      		</tr>
	      		{% for aMember in rakontu_members %}
	  				<tr>
	  				<td>
	  				<p>{{aMember.linkString}} {% ifequal aMember.key current_member.key %} <i>({{template_you}})</i> {% endifequal %}
	  				</p>
	  				{% if aMember.isOnlineMember %}
		  				<p>{{aMember.googleUserEmailOrNotOnline|orNothing}}</p>
		  			{% endif %}
		  			</td>
		  			<td>
		  				{% if aMember.isOnlineMember %}
		  					{% if aMember.lastReadAnything %}
			  					{% if current_member.timeFormat %}
			  						<p>{{aMember.lastReadAnything|timeZone:current_member.timeZoneName|time:current_member.timeFormat|orNothing}}</p>
								{% endif %}
								<p>{{aMember.lastReadAnything|timeZone:current_member.timeZoneName|date:current_member.dateFormat|orNone}}</p>
							{% else %}
								&nbsp;
							{% endif %}
						{% else %}
							&nbsp;
						{% endif %}
					</td>
					<td>
						{% if aMember.lastAddedOrChangedAnything %}
							{% if current_member.timeFormat %}
								<p>{{aMember.lastAddedOrChangedAnything|timeZone:current_member.timeZoneName|time:current_member.timeFormat|orNothing}}</p>
							{% endif %}
							<p>{{aMember.lastAddedOrChangedAnything|timeZone:current_member.timeZoneName|date:current_member.dateFormat|orNone}}</p>
						{% else %}
							&nbsp;
						{% endif %}
		  			<td align="center">{{aMember.nudgePoints}}</td>
	  				{% if not aMember.isOnlineMember %}
	  					<td colspan="3">
	  					&nbsp;
	  				{% else %}
	  					<td>
	  						{% if current_member.isOwner %}
			  					<select name="governanceType">
			  						<option value="member|{{aMember.key}}"
			  							{% if aMember.isRegularMember %}
			  								selected="selected"
			  							{% endif %}
			  							>{{template_member}}</option>
			  						<option value="manager|{{aMember.key}}"
			  							{% if aMember.isManager %}
			  								selected="selected"
			  							{% endif %}
			  							>{{template_manager}}</option>
			  						<option value="owner|{{aMember.key}}"
			  							{% if aMember.isOwner %}
			  								selected="selected"
			  							{% endif %}
			  							>{{template_owner}}</option>
								</select>
							{% else %}
								{% if aMember.isOwner %}
									{{template_owner}}
								{% else %}
				  					<select name="governanceType">
				  						<option value="member|{{aMember.key}}"
				  							{% if aMember.isRegularMember %}
				  								selected="selected"
				  							{% endif %}
				  							>{{template_member}}</option>
				  						<option value="manager|{{aMember.key}}"
				  							{% if aMember.isManager %}
				  								selected="selected"
				  							{% endif %}
				  							>{{template_manager}}</option>
									</select>
								{% endif %}
							{% endif %}
		  					</td>
		  				<td>
		  					{% if aMember.helpingRolesForDisplay %}
		  						{{aMember.helpingRolesForDisplay|join:", "}}
		  					{% else %}
		  						&nbsp;
		  					{% endif %}
		  					</td>
		  				<td>
	  						{% if not aMember.isManagerOrOwner %}
		  						<p>
		      					<input type="checkbox" name="curatorAvailable|{{aMember.key}}" value="yes" id="curatorAvailable|{{aMember.key}}"
		      					{% if aMember.helpingRolesAvailable.0 %}
		      						checked="checked"
		      					{% endif %}
		      					><label for="curatorAvailable|{{aMember.key}}">{{template_curator}}</label>
		      					</p>
		  					
		  						<p>
		      					<input type="checkbox" name="guideAvailable|{{aMember.key}}" value="yes" id="guideAvailable|{{aMember.key}}"
		     					{% if aMember.helpingRolesAvailable.1 %}
		      						checked="checked"
		      					{% endif %}
		      					><label for="guideAvailable|{{aMember.key}}">{{template_guide}}</label>
								</p>
							
		  						<p> 
		      					<input type="checkbox" name="liaisonAvailable|{{aMember.key}}" value="yes" id="liaisonAvailable|{{aMember.key}}"
		     					{% if aMember.helpingRolesAvailable.2 %}
		      						checked="checked"
		      					{% endif %}
		      					><label for="liaisonAvailable|{{aMember.key}}">{{template_liaison}}</label>
		      					</p>
		      				{% else %}
		      					&nbsp;
		      				{% endif %}
		  					</td>
		  			{% endif %}
	  				<td width="100">
	  					<p><input type="checkbox" name="remove|{{aMember.key}}" value="yes" id="remove|{{aMember.key}}">
						<label for="remove|{{aMember.key}}">{{template_inactivate}}</label></p>
	  					</td>
	  				</tr>
	      		{% endfor %}
	      	</table>
	      	</fieldset>
			
			{% if pending_members %}
				<h3>{{template_pending_members}}</h3>
				<fieldset>
		      	<table border="0" cellpadding="4" cellspacing="0">
		      	<tr>
		      		<th>{{template_email}}</th>
		      		<th>{{template_invited}}</th>
		      		<th>{{template_membership_type}}</th>
		      		<th>{{template_remove}}? </th>
		      		</tr>
		      		{% for pending_member in pending_members %}
		  				<tr>
		  				<td>
		  				<input type="text" name="email|{{pending_member.key}}" size="30" value="{{pending_member.email}}" maxlength="{{maxlength_name}}"/>
		  				<input type="submit" name="sendInvitationEmail|{{pending_member.key}}" value="{{button_send_invitation_email}}" class="button_small"
						{% if current_member.showButtonTooltips %}
							title="{{"sending_invitation_emails"|buttonTooltip}}"
						{% endif %}
		  				>
		  				</td>
		  				<td>{{pending_member.invited.date}}<br/>
		  				</td>
	  					<td>
	  					<select name="pendingMember_governanceType|{{pending_member.key}}">
	  						<option value="member"
	  							{% if pending_member.willBeRegularMember %}
	  								selected="selected"
	  							{% endif %}
	  							>{{template_member}}</option>
	  						<option value="manager"
	  							{% if pending_member.willBeManager %}
	  								selected="selected"
	  							{% endif %}
	  							>{{template_manager}}</option>
	  						<option value="owner"
	  							{% if pending_member.willBeOwner %}
	  								selected="selected"
	  							{% endif %}
	  							>{{template_owner}}</option>
	  						</select>
		  				</td>
		  				<td><input type="checkbox" name="removePendingMember|{{pending_member.key}}" id="removePendingMember|{{pending_member.key}}" value="yes"/>
		  				<label for="removePendingMember|{{pending_member.key}}">{{template_remove}}</label></td>
		  				</tr>
		      		{% endfor %}
		      	</table>
		      	</fieldset>
		    {% endif %}
			
	 		<h3>{{template_add_new_members}} {{"adding_members"|tip}}</h3>
			<fieldset>
			<div><textarea name="newMemberEmails" rows="6" cols="40"></textarea></div>
			</fieldset>
			
			{% if inactive_members %}
				<h3>{{template_inactive_members}} {{"inactive_online_members"|tip}}</h3>
				<fieldset>
		      	<table border="0" cellpadding="4" cellspacing="0">
		      		<tr>
		      		<th>{{template_nickname}}</th>
		      		<th>{{template_online}}?</th>
		      		<th>{{template_google_email}}</th>
		      		<th>{{template_membership_type}}</th>
		      		<th>{{template_remove}}? </th>
		      		</tr>
		      		{% for member in inactive_members %}
		  				<tr>
		  				    <td>{{member.nickname}}</td>
		  				    <td>{% if member.isOnlineMember %}
	  								{{template_online}}
	  							{% else %}
	  								{{template_offline}}
	  							{% endif %}
	  						</td>
			  				<td>{{member.googleUserEmailOrNotOnline}}</td>
			  				<td>{{member.governanceTypeForDisplay}}</td>
			  				<td>
			  					{% if not member.hasContributedAnything %}
			  						<input type="checkbox" name="removeInactiveMember|{{member.key}}" id="removeInactiveMember|{{member.key}}" value="yes"/>
			  						<label for="removeInactiveMember|{{member.key}}">{{template_remove}}</label>
			  					{% else %}
			  						{{template_cannot_remove_inactive_member_because_has_items}}
			  					{% endif %}
			  				</td>
		  				</tr>
					{% endfor %}
					</table>
				</fieldset>
			{% endif %}
	
		<p></p>
	    <center><input type="submit" name="submitChanges" value="{{button_save_changes}}" class="button"></center>	
		</form>	
		</div>

	</div>
	{% include "../common_footer.html" %}
	</body>
</html>
